cmake_minimum_required(VERSION 3.5)

project(JZAgent)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

add_compile_options(-g -O0)

# 查找Qt库，优先Qt6，如果找不到则查找Qt5
find_package(Qt6 QUIET COMPONENTS Core Network Xml)
if (Qt6_FOUND)
    set(QT_LIBS Qt6::Core Qt6::Network Qt6::xml)
else()
    # 如果未找到Qt6，尝试查找Qt5	
    find_package(Qt5 COMPONENTS Core Network Xml REQUIRED)
    set(QT_LIBS Qt5::Core Qt5::Network Qt5::Xml)
endif()

include_directories(../jz_project/jzWebServer)
include_directories(../jz_project/jzCo)
include_directories(../jz_project/jzUtils)

set(JZAgent_SOURCES    
    main.cpp
	JZAgent.cpp
	JZAgent.h
    JZAgentTool.cpp
    JZAgentTool.h
    ../jz_project/jzUtils/JZJsonHelper.cpp
    ../jz_project/jzUtils/JZJsonHelper.h
    ../jz_project/jzCo/JZCo.cpp
    ../jz_project/jzCo/JZCo.h
    ../jz_project/jzCo/JZCoContext.cpp
    ../jz_project/jzCo/JZCoContext.h
    ../jz_project/jzCo/JZCoCoroutine.cpp
    ../jz_project/jzCo/JZCoCoroutine.h
    ../jz_project/jzCo/JZCoFile.cpp
    ../jz_project/jzCo/JZCoFile.h
    ../jz_project/jzCo/JZCoNetwork.cpp
    ../jz_project/jzCo/JZCoNetwork.h
    ../jz_project/jzWebServer/JZWebContext.cpp
    ../jz_project/jzWebServer/JZWebContext.h
    ../jz_project/jzWebServer/JZWebHttpCookie.cpp
    ../jz_project/jzWebServer/JZWebHttpCookie.h
    ../jz_project/jzWebServer/JZWebLayout.cpp
    ../jz_project/jzWebServer/JZWebLayout.h
    ../jz_project/jzWebServer/JZWebPage.cpp
    ../jz_project/jzWebServer/JZWebPage.h
    ../jz_project/jzWebServer/JZWebRequest.cpp
    ../jz_project/jzWebServer/JZWebRequest.h
    ../jz_project/jzWebServer/JZWebResponse.cpp
    ../jz_project/jzWebServer/JZWebResponse.h
    ../jz_project/jzWebServer/JZWebServer.cpp
    ../jz_project/jzWebServer/JZWebServer.h
    ../jz_project/jzWebServer/JZWebWidget.cpp
    ../jz_project/jzWebServer/JZWebWidget.h)

add_executable(JZAgent ${JZAgent_SOURCES})

target_link_libraries(JZAgent ${QT_LIBS})